<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    <h1>姓名：{{msg.name}}</h1>
    <h1>年龄：{{msg.age}}</h1>
    <button @click="get">get方法</button>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script>
    var vm = new Vue({
        el: '#app',
        data: {
            msg: {}
        },
        methods: {
            get() {
                axios.get("./a.txt",{
                    //携带参数的写法
                    params: {
                        ID: 1
                    },
                    //请求头中添加参数
                    headers: {
                        token: "123"
                    }
                }).then(
                    res => {
                        this.msg = res.data;
                    }
                ).catch(err =>{
                    console.log(err)
                })
            }
        }
    })
</script>
</body>
</html>